<?php
namespace app\common\validate;
use think\Validate;
class Releases extends Validate {
    protected $rule = [
        //'about' =>'require|max:5',
        'id' =>'number',
        'status' =>'integer|in:0,1',//tp5.1number不支持负数，用integer整数代替验证
        'title' =>'require|max:10',
        'content'=>'require',
    ];
    protected $message  =   [
        //'about.require' => '发布人不能为空',
        'about.max' => '发布人最多不能超过5个字符',
        'title.require' => '标题不能为空',
        'title.max' => '标题最多不能超过10个字符',
        'status.integer'=>'状态必须是整数哟',
        'status.in' => '状态范围必须是0，1',
        'content.require'=>'内容不能为空',
    ];
    /** 场景设置**/
    protected $scene = [
        'add' => ['title','status','content','id'],  //添加
        'status' => ['id', 'status'],

    ];


}


